package gui.crud;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTextField;

import persistence.ClassHandler;

public class ClassEditPanel extends AbstractEditPanel {

	private JTextField cNameField, cDisciplineField;
	private JComboBox<String> comboProfessor;
	
	private JLabel cNameLabel, cDisciplineLabel, comboProfessorLabel;
	
	private ClassHandler c;
	
	public ClassEditPanel() {
		super("Administrar Turmas", 400, 360);
		// TODO Auto-generated constructor stub
	}

	

	@Override
	protected void setUpNewComponents() {
		cNameField = new JTextField();
		cDisciplineField = new JTextField();
		comboProfessor = new JComboBox<String>();
		cNameLabel = new JLabel("<html><i><b>Nome:</b></i></html>");
		cDisciplineLabel = new JLabel("<html><i><b>Disciplina:</b></i></html>");
		comboProfessorLabel = new JLabel("<html><i><b>Professor:</b></i></html>");
		
		//Preencher comboProfessor
		
		cNameField.setBounds(60, 110, 120, 20);
		cDisciplineField.setBounds(200, 110, 120, 20);
		comboProfessor.setBounds(60, 160, 120, 20);
		cNameLabel.setBounds(60, 88, 90, 20);
		cDisciplineLabel.setBounds(200, 88, 90, 20);
		comboProfessorLabel.setBounds(60, 138, 90, 20);
	}

	@Override
	protected void addNewComponents() {
		this.add(cNameField);
		this.add(cDisciplineField);
		this.add(comboProfessor);
		this.add(cNameLabel);
		this.add(cDisciplineLabel);
		this.add(comboProfessorLabel);

	}

	@Override
	protected void setObjectsTypeAndContent() {
		getObjectsLabel().setText("Turmas");
		//deve-se criar c aqui: c = new ClassHandler()
		//E preencher alguma lista com os dados.
		
	}

	@Override
	protected void confirmChanges() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void deleteAction() {
		c.delete(cNameField.getText(), "pegar o codigo pra k", "cod professor");
	}



	@Override
	protected void updateFields() {
		//Quando escolhida uma turma, atualizar os dados nos "fields"
	}
	
}
